package day07;

import java.util.Scanner;

public class Exercise1 {
    public static void main(String[] args) {/*
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入机票原价：");
        double price=scan.nextDouble();
        System.out.println("请输入月份：");
        int month=scan.nextInt();
        System.out.println("请输入舱位：1. 2. 3.");
        int type=scan.nextInt();
        double finalPrice=calAirPrice(price,month,type);
        if (month<=12&&month>=1) {
            System.out.println(finalPrice);
        }
    }
    public static double calAirPrice(double price,int month,int type){
        double finalPrice=0.0;
        if (type<1||type>3){
            System.out.println("舱位输入错误");
            return -1;
        }
        if (month<1||month>12){
            System.out.println("月份输入错误");
            return -1;
        }
        if (month>=5&&month<=10){
            switch (type){
                case 1:
                    finalPrice=price*0.9;
                    break;
                case 2:
                    finalPrice=price*0.85;
                    break;
                case 3:
                    finalPrice=price*0.8;
                    break;
            }
        }else{
            switch (type){
                case 1:
                    finalPrice=price*0.8;
                    break;
                case 2:
                    finalPrice=price*0.75;
                    break;
                case 3:
                    price*=0.7;
                    break;
            }
        }

        return finalPrice;
        */

        double[] p=e();
        double total=o(p);
        System.out.println(total);
        double avg=av(p);
        System.out.println(avg);
    }



    public static double[] e(){
        Scanner scan=new Scanner(System.in);
        double[] p=new double[6];
        for (int i=0;i<p.length;i++){
            System.out.println("请录入第"+(i+1)+"个评委的成绩");
            p[i]=scan.nextInt();
        }
        return p;
    }
    /*
    录入总分
     */
    public static double o(double[] scores){
        double total=0.0;
        double max=scores[0];
        double min=scores[0];
        for (int i=0;i<scores.length;i++){
            if (max<scores[i]){
                max=scores[i];
            }
            if (min>scores[i]){
                min=scores[i];
            }
            total+=scores[i];
        }


        return total-max-min;
    }
    /*
    录入平均分
     */
    public static double av(double[] scores){
        double total=o(scores);
        double avg=total/scores.length-2;
        return avg;
    }
}
